/*
 * ©2023 JOY-HUBS.COM
 */

package com.joyhubs.base.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 业务异常
 *
 * @author green
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class BizException extends RuntimeException {
    
    private final String errorCode;
    private final String errorMsg;
    
    public BizException(Errors error) {
        super(error.code());
        this.errorCode = error.code();
        this.errorMsg = error.msg();
    }
    
    public BizException(String errorCode, String errorMsg) {
        super(errorCode);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }
    
    public BizException(String errorCode, String errorMsg, Throwable cause) {
        super(errorCode, cause);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }
    
}
